﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace GPSTrackingWebsiteManager.ClassManager
{
    public class SessionManager: ClassManager.SessionManagerPage
    {
        public int CompanyID { get; set; }
        public string GUID { get; set; }
        public int CompanyIDSelectedComboBox { get; set; }
        //public int CompanyIDAdminUsername {get; set;}

        public string MasterUsername { get; set; }
        public bool IsMaster { get; set; }
        public string AdminUsername { get; set; }
        public bool IsAdmin { get; set; }
        public string Username { get; set; }
        public bool IsUser { get; set; }

        public bool IsUserRoles { get; set; }
        public bool IsAdminRoles { get; set; }
        public bool IsMasterRoles { get; set; }

        //borrar.
        //public bool IsUsername { get; set; }
        //public bool IsAdminUsername { get; set; }
        //public bool IsMasterUsername { get; set; }
        //public int roleID_User_Adin_Master_Roles { get; set; }

        public int busRouteID_BusRoutesByGPSGroups { get; set; }
        
        //UserRoles
        public int UserRoleID { get; set; }
        //AdminRoles
        public int AdminRoleID { get; set; }
        //MasterRoles
        public int MasterRoleID { get; set; }
        
        //UserRolesByUsers
        public string UsernameForRole { get; set; }
        //AdministratorsRolesByAdministrator
        public string AdminUsernameForRole { get; set; }
        //MasterRolesByMasters
        public string MasterUsernameForRole { get; set; }

        //borrar
        public string user_Adin_Master { get; set; }
        
        
        public string masterUsername_Companies { get; set; }

        //used by CompaniesByMaster and CompanySearch
        public string CompaniesByMaster_companySearch_MasterUsername { get; set;}

        //used by AdministratorsByDepartments and AdministratorsSearch
        public int AdministratorsByDepartments_AdministratorsSeach_departmentID { get; set; }

        //used by UsersByGPSStock and GPSStockComboSearch
        public int UsersByGPSStock_GPSStockComboSearch_GPSGroupID { get; set; }
        public string UsersByGPSStock_GPSStockComboSearch_username { get; set; }
        public int StockByCategories_StocksAditionalImages_StockId { get; set; }

        //used by LinealViewInfo and LinealViewClientsRoute
        public string LinealViewInfo_Username { get; set; }
        public string LinealViewInfo_GPSImei { get; set; }
        public DateTime LinealViewInfo_Date { get; set; }
        public DateTime LinealViewInfo_DateBegin { get; set; }
        public DateTime LinealViewInfo_DateEnd { get; set; }

        public const string SysnTransactionType_Insert = "I";
        public const string SysnTransactionType_Update = "U";
        public const string SysnTransactionType_Delete = "D";       

        public enum AttribTransaction
        { 
            TypeUserTransaction,
            UsernameTransaction 
        }

        public Dictionary<string, string> GetAttribTransaction()
        {
            string typeUserTransaction = "";
            string usernameTransaction = "";

            if (IsUser)
            {
                typeUserTransaction = "U";
                usernameTransaction = Username;
            }
            if (IsAdmin)
            {
                typeUserTransaction = "A";
                usernameTransaction = AdminUsername;
            }
            if (IsMaster)
            {
                typeUserTransaction = "M";
                usernameTransaction = MasterUsername;
            }


            Dictionary<string, string> dictionary = new Dictionary<string, string>();
            dictionary.Add("TypeUserTransaction", typeUserTransaction);
            dictionary.Add("UsernameTransaction", usernameTransaction);

            return dictionary;

        }

    }
}